package service.Impl;

import dao.Impl.ScheduleRepositoryImpl;
import dao.ScheduleRepository;
import entity.Schedule;
import service.ScheduleService;

import java.util.ArrayList;

public class ScheduleServiceImpl implements ScheduleService {

    /**
     * 获取时间表信息
     */

    @Override
    public ArrayList<Schedule> getScheduleList() {
        ScheduleRepository scheduleRepository = new ScheduleRepositoryImpl();
        return scheduleRepository.getScheduleList();
    }

    /**
     * 添加时间表信息
     */
    @Override
    public boolean addSchedule(Schedule schedule) {
        ScheduleRepository scheduleRepository = new ScheduleRepositoryImpl();
        return scheduleRepository.addSchedule(schedule);
    }

    /**
     * 根据时间表编号返回时间表信息
     */
    @Override
    public Schedule findById(Integer scheduleId) {
        ScheduleRepository scheduleRepository = new ScheduleRepositoryImpl();
        return scheduleRepository.findById(scheduleId);
    }

    /**
     * 修改时间表信息
     */
    @Override
    public boolean updateSchedule(Schedule schedule) {
        ScheduleRepository scheduleRepository = new ScheduleRepositoryImpl();
        return scheduleRepository.updateSchedule(schedule);
    }

    /**
     * 根据时间表编号删除时间表信息
     */
    @Override
    public boolean deleteSchedule(Integer scheduleId) {
        ScheduleRepository scheduleRepository = new ScheduleRepositoryImpl();
        return scheduleRepository.deleteSchedule(scheduleId);
    }

}
